r_min = 1 ;
r_max = -1 ;
r_mean = 0 ;
for i = 1 : 10000
NMF_Initialize ;
NMF_Update ;
r1 = corrcoef( A( :, 1 ), t( :, 1 ) ) ;
r2 = corrcoef( A( :, 2 ), t( :, 2 ) ) ;
r3 = corrcoef( A( :, 1 ), t( :, 2 ) ) ;
r4 = corrcoef( A( :, 2 ), t( :, 1 ) ) ;
rmean1 = ( r1( 1, 2 ) + r2( 1, 2 ) ) / 2 ;
rmean2 = ( r3( 1, 2 ) + r4( 1, 2 ) ) / 2 ;
if rmean1 > rmean2
    if rmean1 > r_max
        r_max = rmean1 ;
    end
    if rmean1 < r_min
        r_min = rmean1 ;
    end
    r_mean = ( r_mean * ( i-1 ) + rmean1 ) / i ;
else
    if rmean2 > r_max
        r_max = rmean2 ;
    end
    if rmean2 < r_min
        r_min = rmean2 ;
    end
    r_mean = ( r_mean * ( i-1 ) + rmean2 ) / i ;
end
end